Skip to content

[339] Rename plantWoodCStorageDelta to plantWoodCAccountingDelta#344

Open
ANAMASGARD wants to merge 4 commits into
PecanProject:masterfrom
ANAMASGARD:rename/plantWoodCAccountingDelta-closes-339
Open

[339] Rename plantWoodCStorageDelta to plantWoodCAccountingDelta#344
ANAMASGARD wants to merge 4 commits into
PecanProject:masterfrom
ANAMASGARD:rename/plantWoodCAccountingDelta-closes-339

Conversation

@ANAMASGARD

@ANAMASGARD ANAMASGARD commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

FIXES #339.

Issue #339 refers to plantWoodStorageC; the actual SIPNET identifier was plantWoodCStorageDelta (output column: nppStorage). This PR renames the internal state/restart field to plantWoodCAccountingDelta to reflect that it tracks carbon changes with no associated nitrogen (NPP averaging lag / bookkeeping), not a storage pool.

No change to model equations or numeric results — rename and output formatting only.

Changes (including maintainer review feedback)

  • Internal/restart: plantWoodCStorageDeltaplantWoodCAccountingDelta (envi.plantWoodCAccountingDelta in checkpoints). Legacy envi.plantWoodCStorageDelta keys are rejected (no backward compatibility).
  • sipnet.out debug column: nppStoragecnDelta (shorter debug-only name per review). Internal field name unchanged.
  • plantWoodC column: name unchanged; reports total wood C (structural + accounting term).
  • Docs: plantWoodC footnote [^2] in model-outputs; debug column removed from user docs; internal code names removed from model-structure prose; CHANGELOG updated.

Test plan

  • make testbuild
  • make unit (21/21 pass, including testOutputHeader and restart suite)
  • make smoke (5/5 sipnet; baselines updated for cnDelta column padding)
  • make test
  • python tools/smoke_check.py run verbose base (results below)

smoke_check results

Running tests: niwot, russell_1, russell_2, russell_3, russell_4
Changed working directory to: /home/linux/sipnet/tests/smoke

******************
Running test niwot
******************
Number of columns has changed for test without a header; no comparison can be performed. Skipping.
Note: git col info here may be out of date!
len git cols: 36  len new: 35

**********************
Running test russell_1
**********************
Columns have changed!
Removed columns from git: ['nppStorage']
New columns: ['cnDelta']
Comparing common columns
No differences found

**********************
Running test russell_2
**********************
Columns have changed!
Removed columns from git: ['nppStorage']
New columns: ['cnDelta']
Comparing common columns
No differences found

**********************
Running test russell_3
**********************
Columns have changed!
Removed columns from git: ['nppStorage']
New columns: ['cnDelta']
Comparing common columns
No differences found

**************************************
Skipping russell_4 (found 'skip' file)
**************************************

Full output also saved locally as smoke_check.txt at repo root.

Review responses

  • cnDelta: Renamed debug output column from plantWoodCAccountingDelta to cnDelta; internal field/restart key unchanged.
  • plantWoodC docs: Added footnote [^2] clarifying total wood C = structural + accounting.
  • Debug column docs: Removed from model-outputs.md as debug-only.
  • model-structure: Removed internal identifier from prose; kept $C_{\text{wood,accounting}}$ subscript.
  • Legacy restart key: Removed per @dlebauer feedback (prior commit a03a481).

Copilot AI review requested due to automatic review settings May 27, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR renames SIPNET’s internal “wood storage delta” field to clarify that it is an accounting term (carbon not coupled to nitrogen), and propagates the rename through outputs, restart serialization, tests, and docs.

Changes:

  • Renamed plantWoodCStorageDeltaplantWoodCAccountingDelta across model code and tests.
  • Renamed the sipnet.out column nppStorageplantWoodCAccountingDelta and updated smoke-check tooling and golden outputs.
  • Added backward-compatible restart reading for legacy checkpoints using envi.plantWoodCStorageDelta.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/smoke_check.py Updates expected output column list to match the renamed output field.
tests/smoke/russell_4/sipnet.out Updates smoke-test golden output header for the renamed column.
tests/sipnet/test_restart_infrastructure/mock_state.c Updates restart infra test scaffolding for the renamed environment field.
tests/sipnet/test_events_types/testEventHarvest.c Updates event test initialization to the renamed environment field.
src/sipnet/state.h Renames the environment struct field and clarifies its meaning in comments.
src/sipnet/sipnet.c Renames output column header and replaces all uses of the old field name.
src/sipnet/restart.c Writes restart checkpoints with the new key and reads legacy checkpoints with the old key.
src/sipnet/events.c Updates harvest event calculations to use the renamed field.
src/sipnet/balance.c Updates mass-balance totals and clarifies nitrogen accounting comment.
docs/user-guide/model-outputs.md Documents the new output column name and the prior name.
docs/parameters.md Updates parameter documentation to the new accounting-delta terminology.
docs/model-structure.md Updates model-structure narrative/equations to reflect accounting delta terminology.
docs/developer-guide/restart-checkpoint.md Documents backward-compatible restart key handling post-rename.
docs/CHANGELOG.md Adds changelog entry describing the rename and restart compatibility behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/restart.c Outdated
#define RESTART_SCHEMA_VERSION "1.0"
#define RESTART_FLOAT_EPSILON 1e-8
#define LEGACY_ENVI_PLANT_WOOD_C_STORAGE_DELTA "envi.plantWoodCStorageDelta"
#define ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX 12
Comment thread src/sipnet/restart.c
state->enviPF[10] = (StateField){"envi.litterN", FT_DOUBLE, &envi.litterN, 0};
state->enviPF[11] = (StateField){"envi.plantStorageN", FT_DOUBLE, &envi.plantStorageN, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCStorageDelta", FT_DOUBLE, &envi.plantWoodCStorageDelta, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCAccountingDelta", FT_DOUBLE, &envi.plantWoodCAccountingDelta, 0};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it has not been around long enough (and is an internal detail)

Comment thread src/sipnet/restart.c Outdated
Comment on lines +629 to +631
if (setLegacyPlantWoodCAccountingDelta(
restartIn, key, value,
&state->enviPF[ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX])) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/sipnet.c

fprintf(out, "%4d %3d %5.2f %10.2f %10.2f %12.2f ", year, day, time,
(envi.plantWoodC + envi.plantWoodCStorageDelta), envi.plantLeafC,
(envi.plantWoodC + envi.plantWoodCAccountingDelta), envi.plantLeafC,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For legacy reasons, I think we want to leave that column named plantWoodC.

As for nppStorage, since it is a debug column, I'd like something shorter. How about just cnDelta

@dlebauer dlebauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ANAMASGARD - thank you for your contribution!

I made a few comments, but will defer to @Alomir to determine what, if anything, should be changed before merging.

Comment thread docs/developer-guide/restart-checkpoint.md Outdated
Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/restart.c
state->enviPF[10] = (StateField){"envi.litterN", FT_DOUBLE, &envi.litterN, 0};
state->enviPF[11] = (StateField){"envi.plantStorageN", FT_DOUBLE, &envi.plantStorageN, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCStorageDelta", FT_DOUBLE, &envi.plantWoodCStorageDelta, 0};
state->enviPF[12] = (StateField){"envi.plantWoodCAccountingDelta", FT_DOUBLE, &envi.plantWoodCAccountingDelta, 0};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread src/sipnet/restart.c Outdated
Comment thread src/sipnet/restart.c Outdated
Comment on lines +629 to +631
if (setLegacyPlantWoodCAccountingDelta(
restartIn, key, value,
&state->enviPF[ENVI_PLANT_WOOD_C_ACCOUNTING_DELTA_INDEX])) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to support the legacy key

Comment thread docs/CHANGELOG.md Outdated
ANAMASGARD added a commit to ANAMASGARD/sipnet that referenced this pull request May 30, 2026
Per review on PecanProject#344: do not read envi.plantWoodCStorageDelta from checkpoints.
Update docs and add test that the obsolete key is rejected.
@ANAMASGARD

ANAMASGARD commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @dlebauer for the review — addressed in this new commit

  • Removed legacy envi.plantWoodCStorageDelta restart handling; checkpoints must use envi.plantWoodCAccountingDelta. The old key now fails with unknown key.
  • Updated CHANGELOG and restart docs per your suggested wording.
  • Added testObsoletePlantWoodCStorageDeltaKeyFails in the restart suite to lock in that behavior.

Left the plantWoodC output column naming as-is (it still reports total wood C = structural + accounting delta). Happy to follow up with a plantWoodCTotal rename if you prefer that in a separate PR.

@Alomir Alomir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Some minor tweaks suggested, a few looking for input from @dlebauer.

Also - please run the smoke_check utility and include the results (as an attached file) in the PR description. Use this command:

python tools/smoke_check.py run verbose base > smoke_check.txt

Comment thread docs/user-guide/model-outputs.md Outdated
Comment on lines +47 to +49
| | $C_{\text{wood,accounting}}$ | plantWoodCAccountingDelta | Wood carbon accounting delta (N-lag term; not N-coupled structural wood) | g C m$^{-2}$ |

Note: this column was previously named `nppStorage`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate trying to update the docs! However, this is a debug-only column that will likely be removed before our final deadline.

@dlebauer : do you think this column is worth documenting?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - the plantWoodC row needs a tweak to indicate that it is the total of "regular" plantWoodC and the accounting term. This might be best with a footnote, like soilWetnessFrac.

Comment thread docs/model-structure.md Outdated
Starting in SIPNET v2.1, to support mass balance tracking, this storage is explicitly tracked as a separate pool called
$C_{\text{wood,storage}}$, which is initialized to zero. We can represent this storage of carbon as:
Starting in SIPNET v2.1, to support mass balance tracking, this term is explicitly tracked as
$C_{\text{wood,accounting}}$ (`plantWoodCAccountingDelta`), which is initialized to zero. We can represent this

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$C_{\text{wood,accounting}}$ (`plantWoodCAccountingDelta`), which is initialized to zero. We can represent this
$C_{\text{wood,accounting}}$, which is initialized to zero. We can represent this

We don't include internal naming in this doc

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlebauer : suggestions for the subscript here? accounting is accurate in some sense, but perhaps not the best descriptor. 'non-N', or some such, maybe?

Comment thread src/sipnet/sipnet.c

fprintf(out, "%4d %3d %5.2f %10.2f %10.2f %12.2f ", year, day, time,
(envi.plantWoodC + envi.plantWoodCStorageDelta), envi.plantLeafC,
(envi.plantWoodC + envi.plantWoodCAccountingDelta), envi.plantLeafC,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For legacy reasons, I think we want to leave that column named plantWoodC.

As for nppStorage, since it is a debug column, I'd like something shorter. How about just cnDelta

Comment thread tools/smoke_check.py Outdated
print("Comparing common columns")
else:
cols = 'year day time plantWoodC plantLeafC woodCreation soil coarseRootC fineRootC litter soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration minN soilOrgN litterN n2o nLeaching nFixation nUptake ch4 nppStorage bcdeltaC bcdeltaN'
cols = 'year day time plantWoodC plantLeafC woodCreation soil coarseRootC fineRootC litter soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration minN soilOrgN litterN n2o nLeaching nFixation nUptake ch4 plantWoodCAccountingDelta bcdeltaC bcdeltaN'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

The wood N-lag term is an accounting delta for carbon not coupled to
nitrogen, not a storage pool. Renames the Envi field, sipnet.out column
(was nppStorage), restart key, and docs; legacy restart keys remain readable.
Per review on PecanProject#344: do not read envi.plantWoodCStorageDelta from checkpoints.
Update docs and add test that the obsolete key is rejected.
@ANAMASGARD ANAMASGARD force-pushed the rename/plantWoodCAccountingDelta-closes-339 branch from 9b3e7db to a03a481 Compare June 10, 2026 11:29
Rename sipnet.out debug column to cnDelta per maintainer feedback while
keeping internal/restart key plantWoodCAccountingDelta. Add plantWoodC
footnote, remove debug column from user docs, and fix ch4/cnDelta spacing.
@ANAMASGARD

ANAMASGARD commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@Alomir and @dlebauer I have addressed remaining review feedbacks :

  • Renamed debug sipnet.out column to cnDelta (internal/restart key remains plantWoodCAccountingDelta)
  • Added plantWoodC footnote [^2] in model-outputs; removed debug column from user docs
  • Removed internal code name from model-structure prose
  • Updated smoke_check.py column list and smoke baselines
  • Fixed ch4/cnDelta spacing when cnDelta is negative
  • Ran `make test` (21 unit + 5 smoke) — all pass
  • smoke_check results added to PR description

Ready for re-review @Alomir

@ANAMASGARD ANAMASGARD requested review from Alomir and dlebauer June 10, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename plantWoodStorageC

4 participants